import Link from "next/link";

function HomeIcon({ className = "" }) {
  return <div className={`inline-block w-4 ${className}`}><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">    <path d="M 12 2 A 1 1 0 0 0 11.289062 2.296875 L 1.203125 11.097656 A 0.5 0.5 0 0 0 1 11.5 A 0.5 0.5 0 0 0 1.5 12 L 4 12 L 4 20 C 4 20.552 4.448 21 5 21 L 9 21 C 9.552 21 10 20.552 10 20 L 10 14 L 14 14 L 14 20 C 14 20.552 14.448 21 15 21 L 19 21 C 19.552 21 20 20.552 20 20 L 20 12 L 22.5 12 A 0.5 0.5 0 0 0 23 11.5 A 0.5 0.5 0 0 0 22.796875 11.097656 L 12.716797 2.3027344 A 1 1 0 0 0 12.710938 2.296875 A 1 1 0 0 0 12 2 z"/></svg></div>
}

export default function Breadcrumbs({ links }: { links: { title: string, href?: string, target?: string }[] }) {
  const current = links.at(-1);

  return <div className="flex items-center uppercase font-black text-xs">
    <Link className="flex items-center" href='/'><HomeIcon /></Link>

    {/* {links.length > 1 && links.slice(0, -1).map((link) => {
      return <>
        <span className="mx-4">/</span>
        <Link href={link.href}>{link.title}</Link>
      </>
    })} */}

    <span className="mx-4">/</span>
    <span>{current?.title}</span>
  </div >
}
